package com.hangzhou.xyj.model;

import com.google.gson.annotations.Expose;
import com.google.gson.annotations.SerializedName;
import com.hangzhou.xyj.model.type.EUserType;
import com.j256.ormlite.field.DatabaseField;

import java.io.Serializable;

/**
 * Created by yaohuix on 2016/2/19  15:59
 * <p/>
 * 说明：用户Model
 */
public class UserModel implements Serializable {
    public static final String _ID = "_id";
    public static final String SEX = "_sex";
    public static final String MEMO = "_memo";
    public static final String HEAD_PIC = "_headPic";
    public static final String INTRODUCE = "_introduce";
    public static final String FANS_NUM = "_fansNum";
    public static final String PASSWORD = "_password";
    public static final String FOLLOW_NUM = "_followNum";
    public static final String IDCARD_PIC = "_idCardPic";
    public static final String COMPANY_PIC = "_companyPic";
    public static final String NAME = "_name";
    public static final String USERID = "_userId";
    public static final String SIGNATURE = "_signature";
    public static final String MAIL = "_mail";
    public static final String NICKNAME = "_nickName";
    public static final String HOBBY = "_hobby";
    public static final String IDCARD = "_idCard";
    public static final String CHECK_TIME = "_checkTime";
    public static final String GMT_CREATE = "_gmtCreate";
    public static final String TEACHER_FROM = "_teacherFrom";
    public static final String FOLLOW_ID = "_followId";
    public static final String TEACHER = "_teacher";
    public static final String ZONE = "_zone";

    //预留字段:用于数据库
    public static final String DATA0 = "_data0";
    public static final String DATA1 = "_data1";
    public static final String DATA2 = "_data2";
    public static final String DATA3 = "_data3";
    public static final String DATA4 = "_data4";
    public static final String DATA5 = "_data5";
    public static final String DATA6 = "_data6";
    public static final String DATA7 = "_data7";

    @DatabaseField(id = true, columnName = _ID)
    @Expose
    private String _id; //用户唯一标识

    @DatabaseField(columnName = NAME)
    private String name;//名字

    @DatabaseField(columnName = PASSWORD)
    private String password;//密码

    @DatabaseField(columnName = SEX)
    private String sex;//性别

    @DatabaseField(columnName = MEMO)
    private String memo;//备注

    @SerializedName("account_type")
    private String accountType;//账号类型，如：wx，wb，qq

    @DatabaseField(columnName = NICKNAME)
    @SerializedName("nickname")
    private String nickName;//昵称

    @DatabaseField(columnName = HEAD_PIC)
    @SerializedName("head_pic")
    private String headPic;//头像

    @DatabaseField(columnName = HOBBY)
    private String hobby;//爱好

    private String catStr;//剧种类别

    @DatabaseField(columnName = INTRODUCE)
    private String introduce;//简介

    @DatabaseField(columnName = FANS_NUM)
    @SerializedName("fans_num")
    private int fansNum;//粉丝数量

    private EUserType userType;

    private String owner;//团长或者真实姓名

    @DatabaseField(columnName = FOLLOW_NUM)
    @SerializedName("follow_num")
    private int followNum;//关注的数量

    @SerializedName("gmt_last_login_time")
    private String lastLoginTime;//最后登录时间

    @SerializedName("gmt_modify")
    private String modifyTime;//修改时间

    @DatabaseField(columnName = IDCARD_PIC)
    @SerializedName("idcard_pic")
    private String idCardPic;//身份证pic

    @DatabaseField(columnName = COMPANY_PIC)
    @SerializedName("company_pic")
    private String companyPic;//所属院团pic

    private int type;//用户类型 ：1 是普通用户 2 是名家 3 是名团
    @SerializedName("check_flag")
    private int checkFlag;//认证标志：0 待审核 1 个人认证 2 团体认证 4 审核未通过   // 0待审核 1专业认证 2名团认证 3 名家认证 4 审核未通过  5 专业审核中 6 名团审核中

    @DatabaseField(columnName = USERID)
    @SerializedName("id")
    private String userId;//用户id，唯一标识

    private int user_id;//用户id（除了登录以外使用）

    @DatabaseField(columnName = SIGNATURE)
    private String signature;//签名

    @DatabaseField(columnName = MAIL)
    private String mail;//邮箱

    @DatabaseField(columnName = IDCARD)
    @SerializedName("idcard")
    private String idCard;//身份证号码

    @DatabaseField(columnName = CHECK_TIME)
    @SerializedName("check_time")
    private String checkTime;//认证时间

    @DatabaseField(columnName = GMT_CREATE)
    @SerializedName("gmt_create")
    private String createTime;//创建时间

    @DatabaseField(columnName = TEACHER_FROM)
    @SerializedName("teacher_from")
    private String teacherFrom;//师承

    @DatabaseField(columnName = FOLLOW_ID)
    @SerializedName("follow_id")
    private String followId;//关注人列表

    @DatabaseField(columnName = TEACHER)
    private String teacher;//师从

    private boolean isFollow;//是否关注

    @DatabaseField(columnName = ZONE)
    private String zone;//区域

    @SerializedName("dynamic_num")
    private int dynamicNum;//动态数

    @SerializedName("belong_org")
    private String belongOrg;//剧团名称

    private String sortLetters;  //拼音的首字母
    private boolean isAreaFirst;//是否是该区域的第一个
    private boolean isLastOne;//是否是最后一个元素
    private boolean isAreaLast;//是否是该区域的最后一个

    //预留字段
    @DatabaseField(columnName = DATA0)
    private String data0;
    @DatabaseField(columnName = DATA1)
    private String data1;
    @DatabaseField(columnName = DATA2)
    private String data2;
    @DatabaseField(columnName = DATA3)
    private String data3;
    @DatabaseField(columnName = DATA4)
    private String data4;
    @DatabaseField(columnName = DATA5)
    private String data5;
    @DatabaseField(columnName = DATA6)
    private String data6;
    @DatabaseField(columnName = DATA7)
    private String data7;


    public UserModel() {
    }

    public UserModel(String followId) {
        this.followId = followId;
    }

    @Override
    public String toString() {
        return "{name=" + name + ",userId=" + userId + ",isAreaFirst=" + isAreaFirst + ",isLastOne=" + isLastOne + ",isAreaLast=" + isAreaLast +
                "}";
    }

    public EUserType getUserType() {
        if (getType() == 1 && getCheckFlag() == 1) return EUserType.AUTHORIZED_USER;
        else if (getType() == 1 && getCheckFlag() == 2) return EUserType.AUTHORIZED_TEAM;
        else if (getType() == 2) return EUserType.FAMOUS_EXPERT;
        else if (getType() == 3) return EUserType.FAMOUS_TEAM;
        else if (getType() == 1) return EUserType.NORMAL_USER;
        else return EUserType.UNKNOWN;
    }

//    @Override
//    public boolean equals(Object o) {
//        if (o instanceof UserModel) {
//            if (((UserModel) o).getFollowId().equals(userId)) {
//                return true;
//            }
//        }
//        return false;
//    }

    public boolean getIsFollow() {
        return isFollow;
    }

    public void setIsFollow(boolean isFollow) {
        this.isFollow = isFollow;
    }

    public String getCatStr() {
        return catStr;
    }

    public void setCatStr(String catStr) {
        this.catStr = catStr;
    }

    public int getType() {
        return type;
    }

    public void setType(int type) {
        this.type = type;
    }

    public int getUser_id() {
        return user_id;
    }

    public void setUser_id(int user_id) {
        this.user_id = user_id;
    }

    public int getCheckFlag() {
        return checkFlag;
    }

    public void setCheckFlag(int checkFlag) {
        this.checkFlag = checkFlag;
    }

    public String getSortLetters() {
        return sortLetters;
    }

    public void setSortLetters(String sortLetters) {
        this.sortLetters = sortLetters;
    }

    public boolean isLastOne() {
        return isLastOne;
    }

    public String getBelongOrg() {
        return belongOrg;
    }

    public void setBelongOrg(String belongOrg) {
        this.belongOrg = belongOrg;
    }

    public String getOwner() {
        return owner;
    }

    public void setOwner(String owner) {
        this.owner = owner;
    }

    public void setIsLastOne(boolean isLastOne) {
        this.isLastOne = isLastOne;
    }

    public boolean isAreaLast() {
        return isAreaLast;
    }

    public void setIsAreaLast(boolean isAreaLast) {
        this.isAreaLast = isAreaLast;
    }

    public boolean getIsAreaFirst() {
        return isAreaFirst;
    }

    public void setIsAreaFirst(boolean isAreaFirst) {
        this.isAreaFirst = isAreaFirst;
    }

    public String getUserId() {
        return userId;
    }

    public void setUserId(String userId) {
        this.userId = userId;
    }

    public String getTeacherFrom() {
        return teacherFrom;
    }

    public void setTeacherFrom(String teacherFrom) {
        this.teacherFrom = teacherFrom;
    }

    public String getZone() {
        return zone;
    }

    public void setZone(String zone) {
        this.zone = zone;
    }

    public String getTeacher() {
        return teacher;
    }

    public void setTeacher(String teacher) {
        this.teacher = teacher;
    }

    public String getSignature() {
        return signature;
    }

    public void setSignature(String signature) {
        this.signature = signature;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getNickName() {
        return nickName;
    }

    public void setNickName(String nickName) {
        this.nickName = nickName;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }


    public String getMemo() {
        return memo;
    }

    public void setMemo(String memo) {
        this.memo = memo;
    }

    public String getMail() {
        return mail;
    }

    public void setMail(String mail) {
        this.mail = mail;
    }


    public String getIntroduce() {
        return introduce;
    }

    public void setIntroduce(String introduce) {
        this.introduce = introduce;
    }

    public String getIdCardPic() {
        return idCardPic;
    }

    public void setIdCardPic(String idCardPic) {
        this.idCardPic = idCardPic;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getId() {
        return _id;
    }

    public void setId(String id) {
        this._id = id;
    }

    public String getHobby() {
        return hobby;
    }

    public void setHobby(String hobby) {
        this.hobby = hobby;
    }

    public String getHeadPic() {
        return headPic;
    }

    public void setHeadPic(String headPic) {
        this.headPic = headPic;
    }

    public int getFollowNum() {
        return followNum;
    }

    public void setFollowNum(int followNum) {
        this.followNum = followNum;
    }

    public int getDynamicNum() {
        return dynamicNum;
    }

    public void setDynamicNum(int dynamicNum) {
        this.dynamicNum = dynamicNum;
    }

    public String getFollowId() {
        return followId;
    }

    public void setFollowId(String followId) {
        this.followId = followId;
    }

    public int getFansNum() {
        return fansNum;
    }

    public void setFansNum(int fansNum) {
        this.fansNum = fansNum;
    }


    public String getCompanyPic() {
        return companyPic;
    }

    public void setCompanyPic(String companyPic) {
        this.companyPic = companyPic;
    }

    public String getCheckTime() {
        return checkTime;
    }

    public void setCheckTime(String checkTime) {
        this.checkTime = checkTime;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getLastLoginTime() {
        return lastLoginTime;
    }

    public void setLastLoginTime(String lastLoginTime) {
        this.lastLoginTime = lastLoginTime;
    }

    public String getModifyTime() {
        return modifyTime;
    }

    public void setModifyTime(String modifyTime) {
        this.modifyTime = modifyTime;
    }

    public String getAccountType() {
        return accountType;
    }

    public void setAccountType(String accountType) {
        this.accountType = accountType;
    }

    public String getData0() {
        return data0;
    }

    public void setData0(String data0) {
        this.data0 = data0;
    }

    public String getData1() {
        return data1;
    }

    public void setData1(String data1) {
        this.data1 = data1;
    }

    public String getData2() {
        return data2;
    }

    public void setData2(String data2) {
        this.data2 = data2;
    }

    public String getData3() {
        return data3;
    }

    public void setData3(String data3) {
        this.data3 = data3;
    }

    public String getData4() {
        return data4;
    }

    public void setData4(String data4) {
        this.data4 = data4;
    }

    public String getData5() {
        return data5;
    }

    public void setData5(String data5) {
        this.data5 = data5;
    }

    public String getData6() {
        return data6;
    }

    public void setData6(String data6) {
        this.data6 = data6;
    }

    public String getData7() {
        return data7;
    }

    public void setData7(String data7) {
        this.data7 = data7;
    }
}
